package com.raven.craft.code.generator.mysql.repo.mapper;

import com.raven.craft.code.generator.mysql.repo.entity.TableStatus;
import org.apache.ibatis.annotations.*;

/**
 * @author raven
 * @date 2019-06-10 17:19
 */
@Mapper
public interface TableStatusMapper {

    @Results(id = "tableStatusMap", value = {
            @Result(property = "name", column = "Name"),
            @Result(property = "engine", column = "Engine"),
            @Result(property = "version", column = "Version"),
            @Result(property = "rowFormat", column = "Row_format"),
            @Result(property = "rows", column = "Rows"),
            @Result(property = "avgRowLength", column = "Avg_row_length"),
            @Result(property = "dataLength", column = "Data_length"),
            @Result(property = "maxDataLength", column = "Max_data_length"),
            @Result(property = "indexLength", column = "Index_length"),
            @Result(property = "dataFree", column = "Data_free"),
            @Result(property = "autoIncrement", column = "Auto_increment"),
            @Result(property = "createTime", column = "Create_time"),
            @Result(property = "updateTime", column = "Update_time"),
            @Result(property = "checkTime", column = "Check_time"),
            @Result(property = "collation", column = "Collation"),
            @Result(property = "checksum", column = "Checksum"),
            @Result(property = "createOptions", column = "Create_options"),
            @Result(property = "comment", column = "Comment")
    })
    @Select("show table status like #{tableName}")
    TableStatus getByTableName(@Param("tableName") String tableName);
}
